package com.own.business.wallet.common.handler;

import com.own.business.wallet.common.exception.WalletException;
import com.own.component.common.model.ExceptionMessageModel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.core.annotation.Order;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * WalletExceptionHandler
 *
 * @author chenxueli
 * @date 2023-07-13 16:33:20
 */
@Slf4j
@Order(1)
@RestControllerAdvice
public class WalletExceptionHandler {

    @ExceptionHandler(WalletException.class)
    public ExceptionMessageModel handleSystemException(WalletException e) {
        log.error(e.getMessage(), e);
        return new ExceptionMessageModel(e);
    }

}
